{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39  \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53  \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32  \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90  \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "data = pd.read_csv('./stock_day/stock_day.csv')\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['2018-02-27', '2018-02-26', '2018-02-23', '2018-02-22', '2018-02-14',\n",
       "       '2018-02-13', '2018-02-12', '2018-02-09', '2018-02-08', '2018-02-07',\n",
       "       ...\n",
       "       '2015-03-13', '2015-03-12', '2015-03-11', '2015-03-10', '2015-03-09',\n",
       "       '2015-03-06', '2015-03-05', '2015-03-04', '2015-03-03', '2015-03-02'],\n",
       "      dtype='object', length=643)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "date = pd.to_datetime(data.index)\n",
    "#转换成日期对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['date'] = date.weekday"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "      <th>date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \\\n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39   \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53   \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32   \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90   \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58   \n",
       "\n",
       "            date  \n",
       "2018-02-27     1  \n",
       "2018-02-26     0  \n",
       "2018-02-23     4  \n",
       "2018-02-22     3  \n",
       "2018-02-14     2  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "      <th>date</th>\n",
       "      <th>p_change_num</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \\\n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39   \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53   \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32   \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90   \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58   \n",
       "\n",
       "            date  p_change_num  \n",
       "2018-02-27     1             1  \n",
       "2018-02-26     0             1  \n",
       "2018-02-23     4             1  \n",
       "2018-02-22     3             1  \n",
       "2018-02-14     2             1  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['p_change_num'] = np.where(data['p_change']>0,1,0)\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = pd.crosstab(data['date'],data['p_change_num'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "fina = temp.div(temp.sum(axis=1),axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1056be278>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fina.plot(kind = 'bar',stacked = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "      <th>date</th>\n",
       "      <th>p_change_num</th>\n",
       "      <th>p_change_num2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \\\n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39   \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53   \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32   \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90   \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58   \n",
       "\n",
       "            date  p_change_num  p_change_num2  \n",
       "2018-02-27     1             1             10  \n",
       "2018-02-26     0             1             10  \n",
       "2018-02-23     4             1             10  \n",
       "2018-02-22     3             1             10  \n",
       "2018-02-14     2             1             10  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['p_change_num2'] = np.where(data['p_change']>0,10,0)\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "      <th>date</th>\n",
       "      <th>p_change_num</th>\n",
       "      <th>p_change_num2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-13</th>\n",
       "      <td>21.40</td>\n",
       "      <td>21.90</td>\n",
       "      <td>21.48</td>\n",
       "      <td>21.31</td>\n",
       "      <td>30802.45</td>\n",
       "      <td>0.28</td>\n",
       "      <td>1.32</td>\n",
       "      <td>21.342</td>\n",
       "      <td>22.103</td>\n",
       "      <td>23.387</td>\n",
       "      <td>39694.65</td>\n",
       "      <td>45518.14</td>\n",
       "      <td>65161.68</td>\n",
       "      <td>0.77</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-12</th>\n",
       "      <td>20.70</td>\n",
       "      <td>21.40</td>\n",
       "      <td>21.19</td>\n",
       "      <td>20.63</td>\n",
       "      <td>32445.39</td>\n",
       "      <td>0.82</td>\n",
       "      <td>4.03</td>\n",
       "      <td>21.504</td>\n",
       "      <td>22.338</td>\n",
       "      <td>23.533</td>\n",
       "      <td>44645.16</td>\n",
       "      <td>45679.94</td>\n",
       "      <td>68686.33</td>\n",
       "      <td>0.81</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-09</th>\n",
       "      <td>21.20</td>\n",
       "      <td>21.46</td>\n",
       "      <td>20.36</td>\n",
       "      <td>20.19</td>\n",
       "      <td>54304.01</td>\n",
       "      <td>-1.50</td>\n",
       "      <td>-6.86</td>\n",
       "      <td>21.920</td>\n",
       "      <td>22.596</td>\n",
       "      <td>23.645</td>\n",
       "      <td>48624.36</td>\n",
       "      <td>48982.38</td>\n",
       "      <td>70552.47</td>\n",
       "      <td>1.36</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-08</th>\n",
       "      <td>21.79</td>\n",
       "      <td>22.09</td>\n",
       "      <td>21.88</td>\n",
       "      <td>21.75</td>\n",
       "      <td>27068.16</td>\n",
       "      <td>0.09</td>\n",
       "      <td>0.41</td>\n",
       "      <td>22.372</td>\n",
       "      <td>23.009</td>\n",
       "      <td>23.839</td>\n",
       "      <td>44411.98</td>\n",
       "      <td>48612.16</td>\n",
       "      <td>73852.45</td>\n",
       "      <td>0.68</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-07</th>\n",
       "      <td>22.69</td>\n",
       "      <td>23.11</td>\n",
       "      <td>21.80</td>\n",
       "      <td>21.29</td>\n",
       "      <td>53853.25</td>\n",
       "      <td>-0.50</td>\n",
       "      <td>-2.24</td>\n",
       "      <td>22.480</td>\n",
       "      <td>23.258</td>\n",
       "      <td>23.929</td>\n",
       "      <td>52281.28</td>\n",
       "      <td>56315.11</td>\n",
       "      <td>74925.33</td>\n",
       "      <td>1.35</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-06</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.55</td>\n",
       "      <td>22.29</td>\n",
       "      <td>22.20</td>\n",
       "      <td>55555.00</td>\n",
       "      <td>-0.97</td>\n",
       "      <td>-4.17</td>\n",
       "      <td>22.864</td>\n",
       "      <td>23.607</td>\n",
       "      <td>24.029</td>\n",
       "      <td>51341.63</td>\n",
       "      <td>64413.58</td>\n",
       "      <td>75738.95</td>\n",
       "      <td>1.39</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-05</th>\n",
       "      <td>22.45</td>\n",
       "      <td>23.39</td>\n",
       "      <td>23.27</td>\n",
       "      <td>22.25</td>\n",
       "      <td>52341.39</td>\n",
       "      <td>0.65</td>\n",
       "      <td>2.87</td>\n",
       "      <td>23.172</td>\n",
       "      <td>23.928</td>\n",
       "      <td>24.112</td>\n",
       "      <td>46714.72</td>\n",
       "      <td>69278.66</td>\n",
       "      <td>77070.00</td>\n",
       "      <td>1.31</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-02</th>\n",
       "      <td>22.40</td>\n",
       "      <td>22.70</td>\n",
       "      <td>22.62</td>\n",
       "      <td>21.53</td>\n",
       "      <td>33242.11</td>\n",
       "      <td>0.20</td>\n",
       "      <td>0.89</td>\n",
       "      <td>23.272</td>\n",
       "      <td>24.114</td>\n",
       "      <td>24.184</td>\n",
       "      <td>49340.40</td>\n",
       "      <td>70873.73</td>\n",
       "      <td>79929.71</td>\n",
       "      <td>0.83</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-01</th>\n",
       "      <td>23.71</td>\n",
       "      <td>23.86</td>\n",
       "      <td>22.42</td>\n",
       "      <td>22.22</td>\n",
       "      <td>66414.64</td>\n",
       "      <td>-1.30</td>\n",
       "      <td>-5.48</td>\n",
       "      <td>23.646</td>\n",
       "      <td>24.365</td>\n",
       "      <td>24.279</td>\n",
       "      <td>52812.35</td>\n",
       "      <td>80394.43</td>\n",
       "      <td>88480.92</td>\n",
       "      <td>1.66</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-31</th>\n",
       "      <td>23.85</td>\n",
       "      <td>23.98</td>\n",
       "      <td>23.72</td>\n",
       "      <td>23.31</td>\n",
       "      <td>49155.02</td>\n",
       "      <td>-0.11</td>\n",
       "      <td>-0.46</td>\n",
       "      <td>24.036</td>\n",
       "      <td>24.583</td>\n",
       "      <td>24.411</td>\n",
       "      <td>60348.94</td>\n",
       "      <td>80496.48</td>\n",
       "      <td>91666.75</td>\n",
       "      <td>1.23</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-30</th>\n",
       "      <td>23.71</td>\n",
       "      <td>24.08</td>\n",
       "      <td>23.83</td>\n",
       "      <td>23.70</td>\n",
       "      <td>32420.43</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.21</td>\n",
       "      <td>24.350</td>\n",
       "      <td>24.671</td>\n",
       "      <td>24.365</td>\n",
       "      <td>77485.53</td>\n",
       "      <td>84805.23</td>\n",
       "      <td>92943.35</td>\n",
       "      <td>0.81</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-29</th>\n",
       "      <td>24.40</td>\n",
       "      <td>24.63</td>\n",
       "      <td>23.77</td>\n",
       "      <td>23.72</td>\n",
       "      <td>65469.81</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>-2.98</td>\n",
       "      <td>24.684</td>\n",
       "      <td>24.728</td>\n",
       "      <td>24.294</td>\n",
       "      <td>91842.60</td>\n",
       "      <td>91692.73</td>\n",
       "      <td>93456.22</td>\n",
       "      <td>1.64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-26</th>\n",
       "      <td>24.27</td>\n",
       "      <td>24.74</td>\n",
       "      <td>24.49</td>\n",
       "      <td>24.22</td>\n",
       "      <td>50601.83</td>\n",
       "      <td>0.11</td>\n",
       "      <td>0.45</td>\n",
       "      <td>24.956</td>\n",
       "      <td>24.694</td>\n",
       "      <td>24.221</td>\n",
       "      <td>92407.05</td>\n",
       "      <td>92122.56</td>\n",
       "      <td>91980.51</td>\n",
       "      <td>1.27</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-25</th>\n",
       "      <td>24.99</td>\n",
       "      <td>24.99</td>\n",
       "      <td>24.37</td>\n",
       "      <td>24.23</td>\n",
       "      <td>104097.59</td>\n",
       "      <td>-0.93</td>\n",
       "      <td>-3.68</td>\n",
       "      <td>25.084</td>\n",
       "      <td>24.669</td>\n",
       "      <td>24.109</td>\n",
       "      <td>107976.51</td>\n",
       "      <td>99092.73</td>\n",
       "      <td>92262.67</td>\n",
       "      <td>2.61</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-24</th>\n",
       "      <td>25.49</td>\n",
       "      <td>26.28</td>\n",
       "      <td>25.29</td>\n",
       "      <td>25.20</td>\n",
       "      <td>134838.00</td>\n",
       "      <td>-0.20</td>\n",
       "      <td>-0.79</td>\n",
       "      <td>25.130</td>\n",
       "      <td>24.599</td>\n",
       "      <td>23.997</td>\n",
       "      <td>100644.02</td>\n",
       "      <td>93535.55</td>\n",
       "      <td>89522.22</td>\n",
       "      <td>3.37</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-23</th>\n",
       "      <td>25.15</td>\n",
       "      <td>25.53</td>\n",
       "      <td>25.50</td>\n",
       "      <td>24.93</td>\n",
       "      <td>104205.76</td>\n",
       "      <td>0.39</td>\n",
       "      <td>1.55</td>\n",
       "      <td>24.992</td>\n",
       "      <td>24.450</td>\n",
       "      <td>23.844</td>\n",
       "      <td>92124.92</td>\n",
       "      <td>87064.33</td>\n",
       "      <td>85876.80</td>\n",
       "      <td>2.61</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-22</th>\n",
       "      <td>25.14</td>\n",
       "      <td>25.40</td>\n",
       "      <td>25.13</td>\n",
       "      <td>24.75</td>\n",
       "      <td>68292.08</td>\n",
       "      <td>-0.01</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>24.772</td>\n",
       "      <td>24.296</td>\n",
       "      <td>23.644</td>\n",
       "      <td>91542.85</td>\n",
       "      <td>84861.33</td>\n",
       "      <td>84970.00</td>\n",
       "      <td>1.71</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-19</th>\n",
       "      <td>24.60</td>\n",
       "      <td>25.34</td>\n",
       "      <td>25.13</td>\n",
       "      <td>24.42</td>\n",
       "      <td>128449.11</td>\n",
       "      <td>0.53</td>\n",
       "      <td>2.15</td>\n",
       "      <td>24.432</td>\n",
       "      <td>24.254</td>\n",
       "      <td>23.537</td>\n",
       "      <td>91838.07</td>\n",
       "      <td>88985.70</td>\n",
       "      <td>82975.10</td>\n",
       "      <td>3.21</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-18</th>\n",
       "      <td>24.40</td>\n",
       "      <td>24.88</td>\n",
       "      <td>24.60</td>\n",
       "      <td>24.30</td>\n",
       "      <td>67435.14</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.04</td>\n",
       "      <td>24.254</td>\n",
       "      <td>24.192</td>\n",
       "      <td>23.441</td>\n",
       "      <td>90208.95</td>\n",
       "      <td>96567.41</td>\n",
       "      <td>78252.92</td>\n",
       "      <td>1.69</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-17</th>\n",
       "      <td>24.42</td>\n",
       "      <td>24.92</td>\n",
       "      <td>24.60</td>\n",
       "      <td>23.80</td>\n",
       "      <td>92242.51</td>\n",
       "      <td>0.20</td>\n",
       "      <td>0.82</td>\n",
       "      <td>24.068</td>\n",
       "      <td>24.239</td>\n",
       "      <td>23.378</td>\n",
       "      <td>86427.08</td>\n",
       "      <td>102837.01</td>\n",
       "      <td>77049.61</td>\n",
       "      <td>2.31</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-16</th>\n",
       "      <td>23.40</td>\n",
       "      <td>24.60</td>\n",
       "      <td>24.40</td>\n",
       "      <td>23.30</td>\n",
       "      <td>101295.42</td>\n",
       "      <td>0.96</td>\n",
       "      <td>4.10</td>\n",
       "      <td>23.908</td>\n",
       "      <td>24.058</td>\n",
       "      <td>23.321</td>\n",
       "      <td>82003.73</td>\n",
       "      <td>101081.47</td>\n",
       "      <td>74590.92</td>\n",
       "      <td>2.54</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-15</th>\n",
       "      <td>24.01</td>\n",
       "      <td>24.23</td>\n",
       "      <td>23.43</td>\n",
       "      <td>23.30</td>\n",
       "      <td>69768.17</td>\n",
       "      <td>-0.80</td>\n",
       "      <td>-3.30</td>\n",
       "      <td>23.820</td>\n",
       "      <td>23.860</td>\n",
       "      <td>23.257</td>\n",
       "      <td>78179.81</td>\n",
       "      <td>95219.71</td>\n",
       "      <td>71006.65</td>\n",
       "      <td>1.75</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-12</th>\n",
       "      <td>23.70</td>\n",
       "      <td>25.15</td>\n",
       "      <td>24.24</td>\n",
       "      <td>23.42</td>\n",
       "      <td>120303.53</td>\n",
       "      <td>0.56</td>\n",
       "      <td>2.37</td>\n",
       "      <td>24.076</td>\n",
       "      <td>23.748</td>\n",
       "      <td>23.236</td>\n",
       "      <td>86133.33</td>\n",
       "      <td>91838.46</td>\n",
       "      <td>69690.35</td>\n",
       "      <td>3.01</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-11</th>\n",
       "      <td>23.67</td>\n",
       "      <td>23.85</td>\n",
       "      <td>23.67</td>\n",
       "      <td>23.21</td>\n",
       "      <td>48525.75</td>\n",
       "      <td>-0.12</td>\n",
       "      <td>-0.50</td>\n",
       "      <td>24.130</td>\n",
       "      <td>23.548</td>\n",
       "      <td>23.197</td>\n",
       "      <td>102925.87</td>\n",
       "      <td>85432.61</td>\n",
       "      <td>65928.23</td>\n",
       "      <td>1.21</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-10</th>\n",
       "      <td>24.10</td>\n",
       "      <td>24.60</td>\n",
       "      <td>23.80</td>\n",
       "      <td>23.40</td>\n",
       "      <td>70125.79</td>\n",
       "      <td>-0.14</td>\n",
       "      <td>-0.58</td>\n",
       "      <td>24.410</td>\n",
       "      <td>23.394</td>\n",
       "      <td>23.204</td>\n",
       "      <td>119246.95</td>\n",
       "      <td>85508.89</td>\n",
       "      <td>66934.89</td>\n",
       "      <td>1.76</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-13</th>\n",
       "      <td>19.60</td>\n",
       "      <td>21.30</td>\n",
       "      <td>21.13</td>\n",
       "      <td>19.50</td>\n",
       "      <td>171822.69</td>\n",
       "      <td>1.70</td>\n",
       "      <td>8.75</td>\n",
       "      <td>19.228</td>\n",
       "      <td>17.812</td>\n",
       "      <td>16.563</td>\n",
       "      <td>149620.34</td>\n",
       "      <td>114456.84</td>\n",
       "      <td>111752.31</td>\n",
       "      <td>5.88</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-10</th>\n",
       "      <td>19.55</td>\n",
       "      <td>19.89</td>\n",
       "      <td>19.43</td>\n",
       "      <td>19.20</td>\n",
       "      <td>112962.15</td>\n",
       "      <td>-0.19</td>\n",
       "      <td>-0.97</td>\n",
       "      <td>18.334</td>\n",
       "      <td>17.276</td>\n",
       "      <td>16.230</td>\n",
       "      <td>133648.38</td>\n",
       "      <td>109309.78</td>\n",
       "      <td>106228.29</td>\n",
       "      <td>3.87</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-09</th>\n",
       "      <td>18.28</td>\n",
       "      <td>19.89</td>\n",
       "      <td>19.62</td>\n",
       "      <td>18.02</td>\n",
       "      <td>183119.05</td>\n",
       "      <td>1.20</td>\n",
       "      <td>6.51</td>\n",
       "      <td>17.736</td>\n",
       "      <td>16.826</td>\n",
       "      <td>15.964</td>\n",
       "      <td>124323.21</td>\n",
       "      <td>106501.34</td>\n",
       "      <td>104829.10</td>\n",
       "      <td>6.27</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-08</th>\n",
       "      <td>17.60</td>\n",
       "      <td>18.53</td>\n",
       "      <td>18.42</td>\n",
       "      <td>17.60</td>\n",
       "      <td>157725.97</td>\n",
       "      <td>0.88</td>\n",
       "      <td>5.02</td>\n",
       "      <td>17.070</td>\n",
       "      <td>16.394</td>\n",
       "      <td>15.698</td>\n",
       "      <td>101421.29</td>\n",
       "      <td>97906.88</td>\n",
       "      <td>101658.57</td>\n",
       "      <td>5.40</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-07</th>\n",
       "      <td>16.54</td>\n",
       "      <td>17.98</td>\n",
       "      <td>17.54</td>\n",
       "      <td>16.50</td>\n",
       "      <td>122471.85</td>\n",
       "      <td>0.88</td>\n",
       "      <td>5.28</td>\n",
       "      <td>16.620</td>\n",
       "      <td>16.120</td>\n",
       "      <td>15.510</td>\n",
       "      <td>86769.62</td>\n",
       "      <td>97473.29</td>\n",
       "      <td>98832.94</td>\n",
       "      <td>4.19</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-03</th>\n",
       "      <td>16.44</td>\n",
       "      <td>16.77</td>\n",
       "      <td>16.66</td>\n",
       "      <td>16.25</td>\n",
       "      <td>91962.88</td>\n",
       "      <td>0.22</td>\n",
       "      <td>1.34</td>\n",
       "      <td>16.396</td>\n",
       "      <td>15.904</td>\n",
       "      <td>15.348</td>\n",
       "      <td>79293.34</td>\n",
       "      <td>94172.24</td>\n",
       "      <td>99956.63</td>\n",
       "      <td>3.15</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-02</th>\n",
       "      <td>16.21</td>\n",
       "      <td>16.50</td>\n",
       "      <td>16.44</td>\n",
       "      <td>16.21</td>\n",
       "      <td>66336.32</td>\n",
       "      <td>0.15</td>\n",
       "      <td>0.92</td>\n",
       "      <td>16.218</td>\n",
       "      <td>15.772</td>\n",
       "      <td>15.229</td>\n",
       "      <td>84971.19</td>\n",
       "      <td>92655.96</td>\n",
       "      <td>104350.08</td>\n",
       "      <td>2.27</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-01</th>\n",
       "      <td>16.18</td>\n",
       "      <td>16.48</td>\n",
       "      <td>16.29</td>\n",
       "      <td>16.00</td>\n",
       "      <td>68609.42</td>\n",
       "      <td>0.12</td>\n",
       "      <td>0.74</td>\n",
       "      <td>15.916</td>\n",
       "      <td>15.666</td>\n",
       "      <td>15.065</td>\n",
       "      <td>88679.47</td>\n",
       "      <td>95386.75</td>\n",
       "      <td>105692.28</td>\n",
       "      <td>2.35</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-31</th>\n",
       "      <td>16.78</td>\n",
       "      <td>16.88</td>\n",
       "      <td>16.17</td>\n",
       "      <td>16.07</td>\n",
       "      <td>84467.62</td>\n",
       "      <td>-0.25</td>\n",
       "      <td>-1.52</td>\n",
       "      <td>15.718</td>\n",
       "      <td>15.568</td>\n",
       "      <td>14.896</td>\n",
       "      <td>94392.47</td>\n",
       "      <td>100679.68</td>\n",
       "      <td>105615.58</td>\n",
       "      <td>2.89</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-30</th>\n",
       "      <td>15.99</td>\n",
       "      <td>16.63</td>\n",
       "      <td>16.42</td>\n",
       "      <td>15.99</td>\n",
       "      <td>85090.45</td>\n",
       "      <td>0.65</td>\n",
       "      <td>4.12</td>\n",
       "      <td>15.620</td>\n",
       "      <td>15.469</td>\n",
       "      <td>14.722</td>\n",
       "      <td>108176.96</td>\n",
       "      <td>108109.99</td>\n",
       "      <td>108345.78</td>\n",
       "      <td>2.91</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-27</th>\n",
       "      <td>14.90</td>\n",
       "      <td>15.86</td>\n",
       "      <td>15.77</td>\n",
       "      <td>14.90</td>\n",
       "      <td>120352.13</td>\n",
       "      <td>0.84</td>\n",
       "      <td>5.63</td>\n",
       "      <td>15.412</td>\n",
       "      <td>15.314</td>\n",
       "      <td>14.527</td>\n",
       "      <td>109051.14</td>\n",
       "      <td>109047.78</td>\n",
       "      <td>108905.84</td>\n",
       "      <td>4.12</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-26</th>\n",
       "      <td>15.14</td>\n",
       "      <td>15.35</td>\n",
       "      <td>14.93</td>\n",
       "      <td>14.91</td>\n",
       "      <td>84877.75</td>\n",
       "      <td>-0.37</td>\n",
       "      <td>-2.42</td>\n",
       "      <td>15.326</td>\n",
       "      <td>15.184</td>\n",
       "      <td>14.462</td>\n",
       "      <td>100340.74</td>\n",
       "      <td>103146.79</td>\n",
       "      <td>108303.41</td>\n",
       "      <td>2.91</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-25</th>\n",
       "      <td>15.97</td>\n",
       "      <td>15.97</td>\n",
       "      <td>15.30</td>\n",
       "      <td>15.18</td>\n",
       "      <td>97174.40</td>\n",
       "      <td>-0.38</td>\n",
       "      <td>-2.42</td>\n",
       "      <td>15.416</td>\n",
       "      <td>15.102</td>\n",
       "      <td>14.436</td>\n",
       "      <td>102094.02</td>\n",
       "      <td>103156.85</td>\n",
       "      <td>109604.83</td>\n",
       "      <td>3.33</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-24</th>\n",
       "      <td>15.38</td>\n",
       "      <td>16.16</td>\n",
       "      <td>15.68</td>\n",
       "      <td>15.28</td>\n",
       "      <td>153390.08</td>\n",
       "      <td>0.30</td>\n",
       "      <td>1.95</td>\n",
       "      <td>15.418</td>\n",
       "      <td>15.002</td>\n",
       "      <td>14.385</td>\n",
       "      <td>106966.89</td>\n",
       "      <td>105410.25</td>\n",
       "      <td>110336.03</td>\n",
       "      <td>5.25</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-23</th>\n",
       "      <td>15.34</td>\n",
       "      <td>15.56</td>\n",
       "      <td>15.38</td>\n",
       "      <td>15.25</td>\n",
       "      <td>89461.32</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.26</td>\n",
       "      <td>15.318</td>\n",
       "      <td>14.899</td>\n",
       "      <td>14.304</td>\n",
       "      <td>108043.02</td>\n",
       "      <td>100192.60</td>\n",
       "      <td>107645.16</td>\n",
       "      <td>3.06</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-20</th>\n",
       "      <td>15.38</td>\n",
       "      <td>15.48</td>\n",
       "      <td>15.34</td>\n",
       "      <td>15.18</td>\n",
       "      <td>76800.13</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>-0.26</td>\n",
       "      <td>15.216</td>\n",
       "      <td>14.792</td>\n",
       "      <td>14.232</td>\n",
       "      <td>109044.42</td>\n",
       "      <td>105741.03</td>\n",
       "      <td>108857.41</td>\n",
       "      <td>2.63</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-19</th>\n",
       "      <td>15.20</td>\n",
       "      <td>15.64</td>\n",
       "      <td>15.38</td>\n",
       "      <td>15.11</td>\n",
       "      <td>93644.19</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0.46</td>\n",
       "      <td>15.042</td>\n",
       "      <td>14.686</td>\n",
       "      <td>14.153</td>\n",
       "      <td>105952.84</td>\n",
       "      <td>116044.19</td>\n",
       "      <td>111147.22</td>\n",
       "      <td>3.21</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-18</th>\n",
       "      <td>15.18</td>\n",
       "      <td>15.66</td>\n",
       "      <td>15.31</td>\n",
       "      <td>15.02</td>\n",
       "      <td>121538.71</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.86</td>\n",
       "      <td>14.788</td>\n",
       "      <td>14.464</td>\n",
       "      <td>14.058</td>\n",
       "      <td>104219.67</td>\n",
       "      <td>115997.81</td>\n",
       "      <td>112493.60</td>\n",
       "      <td>4.16</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-17</th>\n",
       "      <td>14.90</td>\n",
       "      <td>15.44</td>\n",
       "      <td>15.18</td>\n",
       "      <td>14.63</td>\n",
       "      <td>158770.77</td>\n",
       "      <td>0.31</td>\n",
       "      <td>2.08</td>\n",
       "      <td>14.586</td>\n",
       "      <td>14.223</td>\n",
       "      <td>13.954</td>\n",
       "      <td>103853.62</td>\n",
       "      <td>110551.48</td>\n",
       "      <td>111739.85</td>\n",
       "      <td>5.43</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-16</th>\n",
       "      <td>14.52</td>\n",
       "      <td>15.05</td>\n",
       "      <td>14.87</td>\n",
       "      <td>14.51</td>\n",
       "      <td>94468.30</td>\n",
       "      <td>0.40</td>\n",
       "      <td>2.76</td>\n",
       "      <td>14.480</td>\n",
       "      <td>13.975</td>\n",
       "      <td>13.843</td>\n",
       "      <td>92342.17</td>\n",
       "      <td>108581.56</td>\n",
       "      <td>107464.31</td>\n",
       "      <td>3.23</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-13</th>\n",
       "      <td>14.13</td>\n",
       "      <td>14.50</td>\n",
       "      <td>14.47</td>\n",
       "      <td>14.08</td>\n",
       "      <td>61342.22</td>\n",
       "      <td>0.36</td>\n",
       "      <td>2.55</td>\n",
       "      <td>14.368</td>\n",
       "      <td>13.740</td>\n",
       "      <td>13.740</td>\n",
       "      <td>102437.64</td>\n",
       "      <td>108763.91</td>\n",
       "      <td>108763.91</td>\n",
       "      <td>2.10</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-12</th>\n",
       "      <td>14.11</td>\n",
       "      <td>14.80</td>\n",
       "      <td>14.11</td>\n",
       "      <td>13.95</td>\n",
       "      <td>84978.37</td>\n",
       "      <td>-0.19</td>\n",
       "      <td>-1.33</td>\n",
       "      <td>14.330</td>\n",
       "      <td>13.659</td>\n",
       "      <td>13.659</td>\n",
       "      <td>126135.54</td>\n",
       "      <td>114032.98</td>\n",
       "      <td>114032.98</td>\n",
       "      <td>2.91</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-11</th>\n",
       "      <td>14.80</td>\n",
       "      <td>15.08</td>\n",
       "      <td>14.30</td>\n",
       "      <td>14.14</td>\n",
       "      <td>119708.43</td>\n",
       "      <td>-0.35</td>\n",
       "      <td>-2.39</td>\n",
       "      <td>14.140</td>\n",
       "      <td>13.603</td>\n",
       "      <td>13.603</td>\n",
       "      <td>127775.94</td>\n",
       "      <td>117664.81</td>\n",
       "      <td>117664.81</td>\n",
       "      <td>4.10</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-10</th>\n",
       "      <td>14.20</td>\n",
       "      <td>14.80</td>\n",
       "      <td>14.65</td>\n",
       "      <td>14.01</td>\n",
       "      <td>101213.51</td>\n",
       "      <td>0.34</td>\n",
       "      <td>2.38</td>\n",
       "      <td>13.860</td>\n",
       "      <td>13.503</td>\n",
       "      <td>13.503</td>\n",
       "      <td>117249.34</td>\n",
       "      <td>117372.87</td>\n",
       "      <td>117372.87</td>\n",
       "      <td>3.46</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-09</th>\n",
       "      <td>14.14</td>\n",
       "      <td>14.85</td>\n",
       "      <td>14.31</td>\n",
       "      <td>13.80</td>\n",
       "      <td>144945.66</td>\n",
       "      <td>0.03</td>\n",
       "      <td>0.21</td>\n",
       "      <td>13.470</td>\n",
       "      <td>13.312</td>\n",
       "      <td>13.312</td>\n",
       "      <td>124820.96</td>\n",
       "      <td>120066.09</td>\n",
       "      <td>120066.09</td>\n",
       "      <td>4.96</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-06</th>\n",
       "      <td>13.17</td>\n",
       "      <td>14.48</td>\n",
       "      <td>14.28</td>\n",
       "      <td>13.13</td>\n",
       "      <td>179831.72</td>\n",
       "      <td>1.12</td>\n",
       "      <td>8.51</td>\n",
       "      <td>13.112</td>\n",
       "      <td>13.112</td>\n",
       "      <td>13.112</td>\n",
       "      <td>115090.18</td>\n",
       "      <td>115090.18</td>\n",
       "      <td>115090.18</td>\n",
       "      <td>6.16</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-05</th>\n",
       "      <td>12.88</td>\n",
       "      <td>13.45</td>\n",
       "      <td>13.16</td>\n",
       "      <td>12.87</td>\n",
       "      <td>93180.39</td>\n",
       "      <td>0.26</td>\n",
       "      <td>2.02</td>\n",
       "      <td>12.820</td>\n",
       "      <td>12.820</td>\n",
       "      <td>12.820</td>\n",
       "      <td>98904.79</td>\n",
       "      <td>98904.79</td>\n",
       "      <td>98904.79</td>\n",
       "      <td>3.19</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-04</th>\n",
       "      <td>12.80</td>\n",
       "      <td>12.92</td>\n",
       "      <td>12.90</td>\n",
       "      <td>12.61</td>\n",
       "      <td>67075.44</td>\n",
       "      <td>0.20</td>\n",
       "      <td>1.57</td>\n",
       "      <td>12.707</td>\n",
       "      <td>12.707</td>\n",
       "      <td>12.707</td>\n",
       "      <td>100812.93</td>\n",
       "      <td>100812.93</td>\n",
       "      <td>100812.93</td>\n",
       "      <td>2.30</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-03</th>\n",
       "      <td>12.52</td>\n",
       "      <td>13.06</td>\n",
       "      <td>12.70</td>\n",
       "      <td>12.52</td>\n",
       "      <td>139071.61</td>\n",
       "      <td>0.18</td>\n",
       "      <td>1.44</td>\n",
       "      <td>12.610</td>\n",
       "      <td>12.610</td>\n",
       "      <td>12.610</td>\n",
       "      <td>117681.67</td>\n",
       "      <td>117681.67</td>\n",
       "      <td>117681.67</td>\n",
       "      <td>4.76</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-02</th>\n",
       "      <td>12.25</td>\n",
       "      <td>12.67</td>\n",
       "      <td>12.52</td>\n",
       "      <td>12.20</td>\n",
       "      <td>96291.73</td>\n",
       "      <td>0.32</td>\n",
       "      <td>2.62</td>\n",
       "      <td>12.520</td>\n",
       "      <td>12.520</td>\n",
       "      <td>12.520</td>\n",
       "      <td>96291.73</td>\n",
       "      <td>96291.73</td>\n",
       "      <td>96291.73</td>\n",
       "      <td>3.30</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>643 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low     volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53   95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80   60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71   52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02   36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48   23331.04          0.44      2.05   \n",
       "2018-02-13  21.40  21.90  21.48  21.31   30802.45          0.28      1.32   \n",
       "2018-02-12  20.70  21.40  21.19  20.63   32445.39          0.82      4.03   \n",
       "2018-02-09  21.20  21.46  20.36  20.19   54304.01         -1.50     -6.86   \n",
       "2018-02-08  21.79  22.09  21.88  21.75   27068.16          0.09      0.41   \n",
       "2018-02-07  22.69  23.11  21.80  21.29   53853.25         -0.50     -2.24   \n",
       "2018-02-06  22.80  23.55  22.29  22.20   55555.00         -0.97     -4.17   \n",
       "2018-02-05  22.45  23.39  23.27  22.25   52341.39          0.65      2.87   \n",
       "2018-02-02  22.40  22.70  22.62  21.53   33242.11          0.20      0.89   \n",
       "2018-02-01  23.71  23.86  22.42  22.22   66414.64         -1.30     -5.48   \n",
       "2018-01-31  23.85  23.98  23.72  23.31   49155.02         -0.11     -0.46   \n",
       "2018-01-30  23.71  24.08  23.83  23.70   32420.43          0.05      0.21   \n",
       "2018-01-29  24.40  24.63  23.77  23.72   65469.81         -0.73     -2.98   \n",
       "2018-01-26  24.27  24.74  24.49  24.22   50601.83          0.11      0.45   \n",
       "2018-01-25  24.99  24.99  24.37  24.23  104097.59         -0.93     -3.68   \n",
       "2018-01-24  25.49  26.28  25.29  25.20  134838.00         -0.20     -0.79   \n",
       "2018-01-23  25.15  25.53  25.50  24.93  104205.76          0.39      1.55   \n",
       "2018-01-22  25.14  25.40  25.13  24.75   68292.08         -0.01     -0.04   \n",
       "2018-01-19  24.60  25.34  25.13  24.42  128449.11          0.53      2.15   \n",
       "2018-01-18  24.40  24.88  24.60  24.30   67435.14          0.01      0.04   \n",
       "2018-01-17  24.42  24.92  24.60  23.80   92242.51          0.20      0.82   \n",
       "2018-01-16  23.40  24.60  24.40  23.30  101295.42          0.96      4.10   \n",
       "2018-01-15  24.01  24.23  23.43  23.30   69768.17         -0.80     -3.30   \n",
       "2018-01-12  23.70  25.15  24.24  23.42  120303.53          0.56      2.37   \n",
       "2018-01-11  23.67  23.85  23.67  23.21   48525.75         -0.12     -0.50   \n",
       "2018-01-10  24.10  24.60  23.80  23.40   70125.79         -0.14     -0.58   \n",
       "...           ...    ...    ...    ...        ...           ...       ...   \n",
       "2015-04-13  19.60  21.30  21.13  19.50  171822.69          1.70      8.75   \n",
       "2015-04-10  19.55  19.89  19.43  19.20  112962.15         -0.19     -0.97   \n",
       "2015-04-09  18.28  19.89  19.62  18.02  183119.05          1.20      6.51   \n",
       "2015-04-08  17.60  18.53  18.42  17.60  157725.97          0.88      5.02   \n",
       "2015-04-07  16.54  17.98  17.54  16.50  122471.85          0.88      5.28   \n",
       "2015-04-03  16.44  16.77  16.66  16.25   91962.88          0.22      1.34   \n",
       "2015-04-02  16.21  16.50  16.44  16.21   66336.32          0.15      0.92   \n",
       "2015-04-01  16.18  16.48  16.29  16.00   68609.42          0.12      0.74   \n",
       "2015-03-31  16.78  16.88  16.17  16.07   84467.62         -0.25     -1.52   \n",
       "2015-03-30  15.99  16.63  16.42  15.99   85090.45          0.65      4.12   \n",
       "2015-03-27  14.90  15.86  15.77  14.90  120352.13          0.84      5.63   \n",
       "2015-03-26  15.14  15.35  14.93  14.91   84877.75         -0.37     -2.42   \n",
       "2015-03-25  15.97  15.97  15.30  15.18   97174.40         -0.38     -2.42   \n",
       "2015-03-24  15.38  16.16  15.68  15.28  153390.08          0.30      1.95   \n",
       "2015-03-23  15.34  15.56  15.38  15.25   89461.32          0.04      0.26   \n",
       "2015-03-20  15.38  15.48  15.34  15.18   76800.13         -0.04     -0.26   \n",
       "2015-03-19  15.20  15.64  15.38  15.11   93644.19          0.07      0.46   \n",
       "2015-03-18  15.18  15.66  15.31  15.02  121538.71          0.13      0.86   \n",
       "2015-03-17  14.90  15.44  15.18  14.63  158770.77          0.31      2.08   \n",
       "2015-03-16  14.52  15.05  14.87  14.51   94468.30          0.40      2.76   \n",
       "2015-03-13  14.13  14.50  14.47  14.08   61342.22          0.36      2.55   \n",
       "2015-03-12  14.11  14.80  14.11  13.95   84978.37         -0.19     -1.33   \n",
       "2015-03-11  14.80  15.08  14.30  14.14  119708.43         -0.35     -2.39   \n",
       "2015-03-10  14.20  14.80  14.65  14.01  101213.51          0.34      2.38   \n",
       "2015-03-09  14.14  14.85  14.31  13.80  144945.66          0.03      0.21   \n",
       "2015-03-06  13.17  14.48  14.28  13.13  179831.72          1.12      8.51   \n",
       "2015-03-05  12.88  13.45  13.16  12.87   93180.39          0.26      2.02   \n",
       "2015-03-04  12.80  12.92  12.90  12.61   67075.44          0.20      1.57   \n",
       "2015-03-03  12.52  13.06  12.70  12.52  139071.61          0.18      1.44   \n",
       "2015-03-02  12.25  12.67  12.52  12.20   96291.73          0.32      2.62   \n",
       "\n",
       "               ma5    ma10    ma20      v_ma5     v_ma10     v_ma20  turnover  \\\n",
       "2018-02-27  22.942  22.142  22.875   53782.64   46738.65   55576.11      2.39   \n",
       "2018-02-26  22.406  21.955  22.942   40827.52   42736.34   56007.50      1.53   \n",
       "2018-02-23  21.938  21.929  23.022   35119.58   41871.97   56372.85      1.32   \n",
       "2018-02-22  21.446  21.909  23.137   35397.58   39904.78   60149.60      0.90   \n",
       "2018-02-14  21.366  21.923  23.253   33590.21   42935.74   61716.11      0.58   \n",
       "2018-02-13  21.342  22.103  23.387   39694.65   45518.14   65161.68      0.77   \n",
       "2018-02-12  21.504  22.338  23.533   44645.16   45679.94   68686.33      0.81   \n",
       "2018-02-09  21.920  22.596  23.645   48624.36   48982.38   70552.47      1.36   \n",
       "2018-02-08  22.372  23.009  23.839   44411.98   48612.16   73852.45      0.68   \n",
       "2018-02-07  22.480  23.258  23.929   52281.28   56315.11   74925.33      1.35   \n",
       "2018-02-06  22.864  23.607  24.029   51341.63   64413.58   75738.95      1.39   \n",
       "2018-02-05  23.172  23.928  24.112   46714.72   69278.66   77070.00      1.31   \n",
       "2018-02-02  23.272  24.114  24.184   49340.40   70873.73   79929.71      0.83   \n",
       "2018-02-01  23.646  24.365  24.279   52812.35   80394.43   88480.92      1.66   \n",
       "2018-01-31  24.036  24.583  24.411   60348.94   80496.48   91666.75      1.23   \n",
       "2018-01-30  24.350  24.671  24.365   77485.53   84805.23   92943.35      0.81   \n",
       "2018-01-29  24.684  24.728  24.294   91842.60   91692.73   93456.22      1.64   \n",
       "2018-01-26  24.956  24.694  24.221   92407.05   92122.56   91980.51      1.27   \n",
       "2018-01-25  25.084  24.669  24.109  107976.51   99092.73   92262.67      2.61   \n",
       "2018-01-24  25.130  24.599  23.997  100644.02   93535.55   89522.22      3.37   \n",
       "2018-01-23  24.992  24.450  23.844   92124.92   87064.33   85876.80      2.61   \n",
       "2018-01-22  24.772  24.296  23.644   91542.85   84861.33   84970.00      1.71   \n",
       "2018-01-19  24.432  24.254  23.537   91838.07   88985.70   82975.10      3.21   \n",
       "2018-01-18  24.254  24.192  23.441   90208.95   96567.41   78252.92      1.69   \n",
       "2018-01-17  24.068  24.239  23.378   86427.08  102837.01   77049.61      2.31   \n",
       "2018-01-16  23.908  24.058  23.321   82003.73  101081.47   74590.92      2.54   \n",
       "2018-01-15  23.820  23.860  23.257   78179.81   95219.71   71006.65      1.75   \n",
       "2018-01-12  24.076  23.748  23.236   86133.33   91838.46   69690.35      3.01   \n",
       "2018-01-11  24.130  23.548  23.197  102925.87   85432.61   65928.23      1.21   \n",
       "2018-01-10  24.410  23.394  23.204  119246.95   85508.89   66934.89      1.76   \n",
       "...            ...     ...     ...        ...        ...        ...       ...   \n",
       "2015-04-13  19.228  17.812  16.563  149620.34  114456.84  111752.31      5.88   \n",
       "2015-04-10  18.334  17.276  16.230  133648.38  109309.78  106228.29      3.87   \n",
       "2015-04-09  17.736  16.826  15.964  124323.21  106501.34  104829.10      6.27   \n",
       "2015-04-08  17.070  16.394  15.698  101421.29   97906.88  101658.57      5.40   \n",
       "2015-04-07  16.620  16.120  15.510   86769.62   97473.29   98832.94      4.19   \n",
       "2015-04-03  16.396  15.904  15.348   79293.34   94172.24   99956.63      3.15   \n",
       "2015-04-02  16.218  15.772  15.229   84971.19   92655.96  104350.08      2.27   \n",
       "2015-04-01  15.916  15.666  15.065   88679.47   95386.75  105692.28      2.35   \n",
       "2015-03-31  15.718  15.568  14.896   94392.47  100679.68  105615.58      2.89   \n",
       "2015-03-30  15.620  15.469  14.722  108176.96  108109.99  108345.78      2.91   \n",
       "2015-03-27  15.412  15.314  14.527  109051.14  109047.78  108905.84      4.12   \n",
       "2015-03-26  15.326  15.184  14.462  100340.74  103146.79  108303.41      2.91   \n",
       "2015-03-25  15.416  15.102  14.436  102094.02  103156.85  109604.83      3.33   \n",
       "2015-03-24  15.418  15.002  14.385  106966.89  105410.25  110336.03      5.25   \n",
       "2015-03-23  15.318  14.899  14.304  108043.02  100192.60  107645.16      3.06   \n",
       "2015-03-20  15.216  14.792  14.232  109044.42  105741.03  108857.41      2.63   \n",
       "2015-03-19  15.042  14.686  14.153  105952.84  116044.19  111147.22      3.21   \n",
       "2015-03-18  14.788  14.464  14.058  104219.67  115997.81  112493.60      4.16   \n",
       "2015-03-17  14.586  14.223  13.954  103853.62  110551.48  111739.85      5.43   \n",
       "2015-03-16  14.480  13.975  13.843   92342.17  108581.56  107464.31      3.23   \n",
       "2015-03-13  14.368  13.740  13.740  102437.64  108763.91  108763.91      2.10   \n",
       "2015-03-12  14.330  13.659  13.659  126135.54  114032.98  114032.98      2.91   \n",
       "2015-03-11  14.140  13.603  13.603  127775.94  117664.81  117664.81      4.10   \n",
       "2015-03-10  13.860  13.503  13.503  117249.34  117372.87  117372.87      3.46   \n",
       "2015-03-09  13.470  13.312  13.312  124820.96  120066.09  120066.09      4.96   \n",
       "2015-03-06  13.112  13.112  13.112  115090.18  115090.18  115090.18      6.16   \n",
       "2015-03-05  12.820  12.820  12.820   98904.79   98904.79   98904.79      3.19   \n",
       "2015-03-04  12.707  12.707  12.707  100812.93  100812.93  100812.93      2.30   \n",
       "2015-03-03  12.610  12.610  12.610  117681.67  117681.67  117681.67      4.76   \n",
       "2015-03-02  12.520  12.520  12.520   96291.73   96291.73   96291.73      3.30   \n",
       "\n",
       "            date  p_change_num  p_change_num2  \n",
       "2018-02-27     1             1             10  \n",
       "2018-02-26     0             1             10  \n",
       "2018-02-23     4             1             10  \n",
       "2018-02-22     3             1             10  \n",
       "2018-02-14     2             1             10  \n",
       "2018-02-13     1             1             10  \n",
       "2018-02-12     0             1             10  \n",
       "2018-02-09     4             0              0  \n",
       "2018-02-08     3             1             10  \n",
       "2018-02-07     2             0              0  \n",
       "2018-02-06     1             0              0  \n",
       "2018-02-05     0             1             10  \n",
       "2018-02-02     4             1             10  \n",
       "2018-02-01     3             0              0  \n",
       "2018-01-31     2             0              0  \n",
       "2018-01-30     1             1             10  \n",
       "2018-01-29     0             0              0  \n",
       "2018-01-26     4             1             10  \n",
       "2018-01-25     3             0              0  \n",
       "2018-01-24     2             0              0  \n",
       "2018-01-23     1             1             10  \n",
       "2018-01-22     0             0              0  \n",
       "2018-01-19     4             1             10  \n",
       "2018-01-18     3             1             10  \n",
       "2018-01-17     2             1             10  \n",
       "2018-01-16     1             1             10  \n",
       "2018-01-15     0             0              0  \n",
       "2018-01-12     4             1             10  \n",
       "2018-01-11     3             0              0  \n",
       "2018-01-10     2             0              0  \n",
       "...          ...           ...            ...  \n",
       "2015-04-13     0             1             10  \n",
       "2015-04-10     4             0              0  \n",
       "2015-04-09     3             1             10  \n",
       "2015-04-08     2             1             10  \n",
       "2015-04-07     1             1             10  \n",
       "2015-04-03     4             1             10  \n",
       "2015-04-02     3             1             10  \n",
       "2015-04-01     2             1             10  \n",
       "2015-03-31     1             0              0  \n",
       "2015-03-30     0             1             10  \n",
       "2015-03-27     4             1             10  \n",
       "2015-03-26     3             0              0  \n",
       "2015-03-25     2             0              0  \n",
       "2015-03-24     1             1             10  \n",
       "2015-03-23     0             1             10  \n",
       "2015-03-20     4             0              0  \n",
       "2015-03-19     3             1             10  \n",
       "2015-03-18     2             1             10  \n",
       "2015-03-17     1             1             10  \n",
       "2015-03-16     0             1             10  \n",
       "2015-03-13     4             1             10  \n",
       "2015-03-12     3             0              0  \n",
       "2015-03-11     2             0              0  \n",
       "2015-03-10     1             1             10  \n",
       "2015-03-09     0             1             10  \n",
       "2015-03-06     4             1             10  \n",
       "2015-03-05     3             1             10  \n",
       "2015-03-04     2             1             10  \n",
       "2015-03-03     1             1             10  \n",
       "2015-03-02     0             1             10  \n",
       "\n",
       "[643 rows x 17 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "ename": "KeyError",
     "evalue": "1",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-12-b6cbaeb4f1f3>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpivot_table\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'p_change_num'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'date'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0maggfunc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;31m#再看看\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.virtualenvs/python89/lib/python3.6/site-packages/pandas/core/reshape/pivot.py\u001b[0m in \u001b[0;36mpivot_table\u001b[0;34m(data, values, index, columns, aggfunc, fill_value, margins, dropna, margins_name)\u001b[0m\n\u001b[1;32m    110\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mvalues\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    111\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 112\u001b[0;31m                 \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    113\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    114\u001b[0m         \u001b[0mto_filter\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyError\u001b[0m: 1"
     ]
    }
   ],
   "source": [
    "data.pivot_table(data['p_change_num'],index='date',aggfunc=np.sum)\n",
    "#再看看"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "col =pd.DataFrame({'color': ['white','red','green','red','green'], 'object': ['pen','pencil','pencil','ashtray','pen'],'price1':[5.56,4.20,1.30,0.56,2.75],'price2':[4.75,4.12,1.60,0.75,3.15]})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "col"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "col.groupby(by='color')['price1'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "col['price1'].groupby(col['color']).mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "starbucks = pd.read_csv(\"directory.csv\")\n",
    "starbucks.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "count = starbucks.groupby(['Country']).count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "count['Brand'].plot(kind='bar',figsize = (20,8))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "starbucks.groupby(['Country', 'State/Province']).count().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
